<div class="vehicles index">
<h2><?php __('Veh&iacute;culos');?></h2>
<div class="actions">
	<ul>
		<li><?php echo $html->link(__('AGREGAR UN VEHICULO', true), array('action'=>'add')); ?></li>
		<li><?php echo $html->link(__('VER CATEGORIAS', true), array('controller'=> 'vehiclecats', 'action'=>'index')); ?> </li>
		<li><?php echo $html->link(__('AGREGAR NUEVA CATEGORIA DE VEHICULOS', true), array('controller'=> 'vehiclecats', 'action'=>'add')); ?> </li>
	</ul>
</div>
<p>
<?php
echo $paginator->counter(array(
'format' => __('P&aacute;gina %page% de %pages%, mostrando %current% registros de %count% total, empezando %start%, terminando en %end%', true)
));
?></p>
<div class="paging">
	<?php echo $paginator->prev('<< '.__('Anterior', true), array(), null, array('class'=>'disabled'));?>
 | 	<?php echo $paginator->numbers();?>
	<?php echo $paginator->next(__('Siguiente', true).' >>', array(), null, array('class'=>'disabled'));?>
</div>
<table cellpadding="0" cellspacing="0">
<tr>
	<th><?php echo 'FOTO'; ?></th>
    <th><?php echo $paginator->sort('TITULO DEL CLASIFICADO','titulo');?></th>
	<th><?php echo $paginator->sort('CODIGO','codigo');?></th>
	<th><?php echo $paginator->sort('CLASIFICADO ACTIVO','activo');?></th>
	

	<th><?php echo $paginator->sort('CATEGORIA','vehiclecat_id');?></th>
    <th><?php echo $paginator->sort('PUBLICADO POR','agent_id');?></th>
    <th><?php echo $paginator->sort('VENCE','agent_id');?></th>
	<th><?php echo $paginator->sort('PUBLICADO','created');?></th>
	<th><?php echo $paginator->sort('MODIFICADO','modified');?></th>
	<th class="actions"><?php __('ACCIONES');?></th>
</tr>
<?php
$i = 0;
foreach ($vehicles as $vehicle):
	$class = null;
	
	if ($i++ % 2 == 0) {
		$class = ' class="altrow"';
	}

?>
	<tr<?php echo $class;?>>
		<td>
			<?php foreach($vehicle['Photo'] as $thumb): 
				 
				 if($thumb['orden']==1):
				 	echo $html->image('clasificados/vehiculos/thumbs/'.$thumb['filename']);
					break;
				 endif;
				endforeach;
			?>
            
		</td>
        <td>
			<?php echo $vehicle['Vehicle']['titulo']; ?>
		</td>
		<td>
			<?php echo $vehicle['Vehicle']['codigo']; ?>
		</td>
		<td>
			<?php if($vehicle['Vehicle']['activo'])
			{
				echo "SI";
				
			}else
			{
				echo "NO";
			} 
			
			?>
		</td>


		<td>
			<?php echo $vehicle['Vehiclecat']['name']; ?>
		</td>
        <td>
			<?php echo $vehicle['Vehicle']['agent_id']; ?>
		</td>
        <td>
			<?php echo $time->timeAgoInWords($vehicle['Vehicle']['vence'],$format = 'j-M-Y' ); ?>
		</td>
		<td>
			<?php echo $time->timeAgoInWords($vehicle['Vehicle']['created']); ?>
		</td>
		<td>
			<?php echo $time->timeAgoInWords($vehicle['Vehicle']['modified']); ?>
		</td>
		<td class="actions">

			<?php echo $html->link(__('Modificar', true), array('action'=>'edit', $vehicle['Vehicle']['id'])); ?>

		</td>
	</tr>
<?php endforeach; ?>
</table>
</div>